package com.jihe.com;

import java.util.Objects;

public class Rice {
    private String name;
    private String from;
    private double price;

    public Rice(String name, String from, double price) {
        this.name = name;
        this.from = from;
        this.price = price;
    }

    public Rice() {
    }

    public String getName() {
        return name;
    }

    public String getFrom() {
        return from;
    }

    public double getPrice() {
        return price;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Rice rice = (Rice) o;
        return Double.compare(rice.price, price) == 0 &&
                name.equals(rice.name) &&
                from.equals(rice.from);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, from, price);
    }

    @Override
    public String toString() {
        return "Rice{" +
                "name='" + name + '\'' +
                ", from='" + from + '\'' +
                ", price=" + price +
                '}';
    }
}
